/**
	* Copyright (c) minuteproject, minuteproject@gmail.com
	* All rights reserved.
	* 
	* Licensed under the Apache License, Version 2.0 (the "License")
	* you may not use this file except in compliance with the License.
	* You may obtain a copy of the License at
	* 
	* http://www.apache.org/licenses/LICENSE-2.0
	* 
	* Unless required by applicable law or agreed to in writing, software
	* distributed under the License is distributed on an "AS IS" BASIS,
	* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	* See the License for the specific language governing permissions and
	* limitations under the License.
	* 
	* More information on minuteproject:
	* twitter @minuteproject
	* wiki http://minuteproject.wikispaces.com 
	* blog http://minuteproject.blogspot.net
	* 
*/
/**
	* template reference : 
	* - name : OpenxavaDomainObjectUML
	* - file name : DomainObjectUMLJPAAnnotationOXAnnotationV4.vm
*/
package sistema_oficial.sistema_oficial.domain.sistemaoficial;

//MP-MANAGED-ADDED-AREA-BEGINNING @import@
//MP-MANAGED-ADDED-AREA-ENDING @import@
import java.sql.*;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;

import javax.persistence.*;
import org.openxava.annotations.*;

import calculators.*;

import sistema_oficial.sistema_oficial.domain.sistemaoficial.EstudioRealizado;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.Puesto;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.Municipio;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.Genero;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.Nacionalidad;

/**
 *
 * <p>Title: Colaborador</p>
 *
 * <p>Description: Domain Object describing a Colaborador entity</p>
 *
 */
@Entity (name="Colaborador")
@Table (name="colaborador")
@Views({
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @view-base-colaborador@
	@View(
		name="base",
		members=
        "" 	
        + "identificador  ; "
        + "generoIdentificador  ; "
        + "nombre1  ; "
        + "nombre2  ; "
        + "apellido1  ; "
        + "apellido2  ; "
        + "foto  ; "
        + "municipioIdentificador  ; "
        + "domicilioActual  ; "
        + "telefono  ; "
        + "fechanacimiento  ; "
        + "edad  ; "
        + "nacionalidadIdentificador  ; "
        + "nit  ; "
        + "examenSalud  ; "
        + "terminoServicioMilitar  ; "
        + "cedulaDpi  ; "
        + "porEmergenciaAvisar  ; "
        + "porEmergenciaDireccion  ; "
        + "porEmergenciaTelefono  ; "
		),
//MP-MANAGED-UPDATABLE-ENDING
	@View(
		name="Create", 
		extendsView="base"
	),
	@View(
		name="Update", 
		extendsView="base",
        members=
          "" 	
	    + "estudioRealizado { estudioRealizadoColaboradorViaColaboradorIdentificador };" 
	    + "puesto { puestoColaboradorViaColaboradorIdentificador };" 
	),
	@View(extendsView="base",
        members=
          "" 	
	    ),
    @View(name="colaboradorDEFAULT_VIEW", 
	   members=
          " identificador ;" 	
        + "nombre1  ; "
        + "apellido1  ; "
        
	),
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @view-reference-colaborador@
    @View(name="reference", 
       extendsView="colaboradorDEFAULT_VIEW"
//MP-MANAGED-UPDATABLE-ENDING
    )
})

@Tabs({
@Tab(
properties=
     " identificador "
    +",  nombre1 "
    +",  apellido1 "
    +",  telefono "
    +",  nit "
    +",  cedulaDpi "
)
,
@Tab(
name = "ColaboradorTab",
properties=
	" identificador "
	    +",  nombre1 "
	    +",  apellido1 "
	    +",  telefono "
	    +",  nit "
	    +",  cedulaDpi "
)
,
@Tab(
name = "ColaboradorTabWithRef",
properties=
" identificador "
	    +",  nombre1 "
	    +",  apellido1 "
	    +",  telefono "
	    +",  nit "
	    +",  cedulaDpi "
)
})
//MP-MANAGED-ADDED-AREA-BEGINNING @class-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @class-annotation@
public class Colaborador {

    @Id @Column(name="identificador" ,length=25)
    private String identificador; 

//MP-MANAGED-ADDED-AREA-BEGINNING @nombre1-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @nombre1-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-nombre1@
    @Column(name="nombre1",  length=25, nullable=false,  unique=false)
    @Required
    private String nombre1;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @nombre2-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @nombre2-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-nombre2@
    @Column(name="nombre2",  length=25,  nullable=true,  unique=false)
    private String nombre2;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @apellido1-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @apellido1-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-apellido1@
    @Column(name="apellido1",  length=25, nullable=false,  unique=false)
    @Required
    private String apellido1;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @apellido2-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @apellido2-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-apellido2@
    @Column(name="apellido2",  length=25,  nullable=true,  unique=false)
    private String apellido2;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @foto-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @foto-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-foto@
    @Column(name="foto",    nullable=true,  unique=false)
    @Stereotype("PHOTO")
    private byte[] foto;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @domicilio_actual-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @domicilio_actual-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-domicilio_actual@
    @Column(name="domicilio_actual",  length=100, nullable=false,  unique=false)
    @Required
    private String domicilioActual;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @telefono-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @telefono-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-telefono@
    @Column(name="telefono",  length=25,  nullable=true,  unique=false)
    private String telefono;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @fechaNacimiento-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @fechaNacimiento-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-fechaNacimiento@
    @Column(name="fechaNacimiento",   nullable=false,  unique=false)
    @Required
    private Date fechanacimiento;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @edad-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @edad-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-edad@
    @Column(name="edad",   nullable=false,  unique=false)
    @Required
    private Integer edad;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @nit-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @nit-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-nit@
    @Column(name="nit",  length=25,  nullable=true,  unique=false)
    private String nit;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @examen_salud-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @examen_salud-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-examen_salud@
    @Column(name="examen_salud",   nullable=false,  unique=false)
    @Required
    private Boolean examenSalud;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @termino_servicio_militar-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @termino_servicio_militar-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-termino_servicio_militar@
    @Column(name="termino_servicio_militar",    nullable=true,  unique=false)
    private Boolean terminoServicioMilitar;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @cedula_dpi-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @cedula_dpi-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-cedula_dpi@
    @Column(name="cedula_dpi",  length=50, nullable=false,  unique=false)
    @Required
    private String cedulaDpi;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @por_emergencia_avisar-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @por_emergencia_avisar-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-por_emergencia_avisar@
    @Column(name="por_emergencia_avisar",  length=50, nullable=false,  unique=false)
    @Required
    private String porEmergenciaAvisar;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @por_emergencia_direccion-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @por_emergencia_direccion-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-por_emergencia_direccion@
    @Column(name="por_emergencia_direccion",  length=50, nullable=false,  unique=false)
    @Required
    private String porEmergenciaDireccion;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @por_emergencia_telefono-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @por_emergencia_telefono-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-por_emergencia_telefono@
    @Column(name="por_emergencia_telefono",  length=25, nullable=false,  unique=false)
    @Required
    private String porEmergenciaTelefono;	
//MP-MANAGED-UPDATABLE-ENDING


//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-Municipio-colaborador@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="municipio_identificador", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    private Municipio municipioIdentificador; 
    
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-Genero-colaborador@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="genero_identificador", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    private Genero generoIdentificador; 
    
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-Nacionalidad-colaborador@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="nacionalidad_identificador", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    @DefaultValueCalculator(NacionalidadCalculator.class)
    private Nacionalidad nacionalidadIdentificador; 
    
//MP-MANAGED-UPDATABLE-ENDING
//children
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @child-estudioRealizadoColaboradorViaColaboradorIdentificador-colaborador@
    @OneToMany (targetEntity=sistema_oficial.sistema_oficial.domain.sistemaoficial.EstudioRealizado.class, fetch=FetchType.LAZY, mappedBy="colaboradorIdentificador", cascade=CascadeType.REMOVE)//, cascade=CascadeType.ALL)
    private Set <EstudioRealizado> estudioRealizadoColaboradorViaColaboradorIdentificador = new HashSet<EstudioRealizado>(); 
   
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @child-puestoColaboradorViaColaboradorIdentificador-colaborador@
    @OneToMany (targetEntity=sistema_oficial.sistema_oficial.domain.sistemaoficial.Puesto.class, fetch=FetchType.LAZY, mappedBy="colaboradorIdentificador", cascade=CascadeType.REMOVE)//, cascade=CascadeType.ALL)
    private Set <Puesto> puestoColaboradorViaColaboradorIdentificador = new HashSet<Puesto>(); 
   
//MP-MANAGED-UPDATABLE-ENDING
//m2m
    /**
    * Default constructor
    */
    public Colaborador() {
    }


    public String getIdentificador() {
        return identificador;
    }
	
    public void setIdentificador (String identificador) {
        this.identificador =  identificador;
    }
    

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-nombre1@
    public String getNombre1() {
        return nombre1;
    }
	
    public void setNombre1 (String nombre1) {
        this.nombre1 =  nombre1;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-nombre2@
    public String getNombre2() {
        return nombre2;
    }
	
    public void setNombre2 (String nombre2) {
        this.nombre2 =  nombre2;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-apellido1@
    public String getApellido1() {
        return apellido1;
    }
	
    public void setApellido1 (String apellido1) {
        this.apellido1 =  apellido1;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-apellido2@
    public String getApellido2() {
        return apellido2;
    }
	
    public void setApellido2 (String apellido2) {
        this.apellido2 =  apellido2;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-foto@
    public byte[] getFoto() {
        return foto;
    }
	
    public void setFoto (byte[] foto) {
        this.foto =  foto;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-domicilio_actual@
    public String getDomicilioActual() {
        return domicilioActual;
    }
	
    public void setDomicilioActual (String domicilioActual) {
        this.domicilioActual =  domicilioActual;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-telefono@
    public String getTelefono() {
        return telefono;
    }
	
    public void setTelefono (String telefono) {
        this.telefono =  telefono;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-fechaNacimiento@
    public Date getFechanacimiento() {
        return fechanacimiento;
    }
	
    public void setFechanacimiento (Date fechanacimiento) {
        this.fechanacimiento =  fechanacimiento;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-edad@
    public Integer getEdad() {
        return edad;
    }
	
    public void setEdad (Integer edad) {
        this.edad =  edad;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-nit@
    public String getNit() {
        return nit;
    }
	
    public void setNit (String nit) {
        this.nit =  nit;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-examen_salud@
    public Boolean getExamenSalud() {
        return examenSalud;
    }
	
    public void setExamenSalud (Boolean examenSalud) {
        this.examenSalud =  examenSalud;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-termino_servicio_militar@
    public Boolean getTerminoServicioMilitar() {
        return terminoServicioMilitar;
    }
	
    public void setTerminoServicioMilitar (Boolean terminoServicioMilitar) {
        this.terminoServicioMilitar =  terminoServicioMilitar;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-cedula_dpi@
    public String getCedulaDpi() {
        return cedulaDpi;
    }
	
    public void setCedulaDpi (String cedulaDpi) {
        this.cedulaDpi =  cedulaDpi;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-por_emergencia_avisar@
    public String getPorEmergenciaAvisar() {
        return porEmergenciaAvisar;
    }
	
    public void setPorEmergenciaAvisar (String porEmergenciaAvisar) {
        this.porEmergenciaAvisar =  porEmergenciaAvisar;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-por_emergencia_direccion@
    public String getPorEmergenciaDireccion() {
        return porEmergenciaDireccion;
    }
	
    public void setPorEmergenciaDireccion (String porEmergenciaDireccion) {
        this.porEmergenciaDireccion =  porEmergenciaDireccion;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-por_emergencia_telefono@
    public String getPorEmergenciaTelefono() {
        return porEmergenciaTelefono;
    }
	
    public void setPorEmergenciaTelefono (String porEmergenciaTelefono) {
        this.porEmergenciaTelefono =  porEmergenciaTelefono;
    } 
//MP-MANAGED-UPDATABLE-ENDING


    public Municipio getMunicipioIdentificador () {  //
    	return municipioIdentificador;
    }
	
    public void setMunicipioIdentificador (Municipio municipioIdentificador) {
    	this.municipioIdentificador = municipioIdentificador;//this.municipioIdentificador = municipio;
    }
    public Genero getGeneroIdentificador () {  //
    	return generoIdentificador;
    }
	
    public void setGeneroIdentificador (Genero generoIdentificador) {
    	this.generoIdentificador = generoIdentificador;//this.generoIdentificador = genero;
    }
    public Nacionalidad getNacionalidadIdentificador () {  //
    	return nacionalidadIdentificador;
    }
	
    public void setNacionalidadIdentificador (Nacionalidad nacionalidadIdentificador) {
    	this.nacionalidadIdentificador = nacionalidadIdentificador;//this.nacionalidadIdentificador = nacionalidad;
    }

    public Set<EstudioRealizado> getEstudioRealizadoColaboradorViaColaboradorIdentificador() {
        if (estudioRealizadoColaboradorViaColaboradorIdentificador == null){
            estudioRealizadoColaboradorViaColaboradorIdentificador = new HashSet<EstudioRealizado>();
        }
        return estudioRealizadoColaboradorViaColaboradorIdentificador;
    }

    public void setEstudioRealizadoColaboradorViaColaboradorIdentificador (Set<EstudioRealizado> estudioRealizadoColaboradorViaColaboradorIdentificador) {
        this.estudioRealizadoColaboradorViaColaboradorIdentificador = estudioRealizadoColaboradorViaColaboradorIdentificador;
    }	
    
    public void addEstudioRealizadoColaboradorViaColaboradorIdentificador (EstudioRealizado estudioRealizado) {
    	    getEstudioRealizadoColaboradorViaColaboradorIdentificador().add(estudioRealizado);
    }
    
    public Set<Puesto> getPuestoColaboradorViaColaboradorIdentificador() {
        if (puestoColaboradorViaColaboradorIdentificador == null){
            puestoColaboradorViaColaboradorIdentificador = new HashSet<Puesto>();
        }
        return puestoColaboradorViaColaboradorIdentificador;
    }

    public void setPuestoColaboradorViaColaboradorIdentificador (Set<Puesto> puestoColaboradorViaColaboradorIdentificador) {
        this.puestoColaboradorViaColaboradorIdentificador = puestoColaboradorViaColaboradorIdentificador;
    }	
    
    public void addPuestoColaboradorViaColaboradorIdentificador (Puesto puesto) {
    	    getPuestoColaboradorViaColaboradorIdentificador().add(puesto);
    }
    



//MP-MANAGED-ADDED-AREA-BEGINNING @implementation@
//MP-MANAGED-ADDED-AREA-ENDING @implementation@

}
